Skip to content

[NO TICKET] Fix_database_cmd_warnings #331

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Ioannis
Copy link
Contributor

@Ioannis Ioannis commented Sep 1, 2025

No description provided.

app/src/Lib/Util/SchemaManager.php Outdated Show resolved Hide resolved
Comment on lines +373 to +388
// PostgreSQL: translate DROP INDEX for names that are actually unique constraints
if($this->conn->driver == 'Cake\Database\Driver\Postgres'
&& preg_match('/^DROP INDEX\s+"?([a-zA-Z0-9_\.]+)"?/i', $sql, $m)) {
$idxOrConstraint = $m[1];

// Resolve if this name is a constraint and on which table
$qualifiedTable = $this->resolvePgConstraintTable($idxOrConstraint);

if($qualifiedTable !== null) {
// We will skip this index if it's bound to a constraint
if($this->io) $this->io->out('Skipping index:' . $m[1] . ' drop since it is bound to a constraint');
continue;
}
}

// PostgreSQL: make index renames idempotent and tolerant using IF EXISTS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try getting these issues addressed upstream rather than having to patch around DBAL behavior?

Copy link
Contributor Author

@Ioannis Ioannis Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benno Before we can begin implementing changes, I believe it is essential to first upgrade to the latest version, which is currently 4.3. Once the system is up to date, we can start evaluating and suggesting modifications. For instance, introducing changes such as ALTER INDEX IF EXISTS should be considered early in the process. However, our initial priority should be to complete the version upgrade.

After upgrading, I would like to reassess these changes. This will allow us to determine whether the latest upstream code addresses our concerns or if any issues remain. The goal of this pull request is twofold: first, to resolve any issues or warnings reported at runtime via the command line, which can be confusing for deployers; and second, to address deprecations in preparation for the upgrade.

As part of the 5.2.7 upgrade, I have updated DBAL to the latest 3.x release for stability. Once we are running the most recent version of CakePHP, we can safely move to the latest DBAL and begin making further improvements.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benno i created the CFM-467 ticket to track the reassessment

Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants